<?php
class Planes extends Model
{
	var $conjunto;
	function Planes()
	{
		parent::Model();
		$conjunto=array();
	}
	
	function getEveryone()
	{
		$this->db->order_by("nombre", "asc");
		$query = $this->db->get('accion');
		return $query->result();
	}
	
	function getEveryoneProject()
	{
		$this->db->where('tipo', 'proyecto');
		$this->db->order_by("nombre", "asc");
		$query = $this->db->get('accion');
		return $query->result();
	}
	
	function getEveryoneTask()
	{
		$this->db->where('tipo', 'tarea');
		$this->db->order_by("nombre", "asc");
		$query = $this->db->get('accion');
		return $query->result();
	}
	
	function getOne($id)
	{
		$this->db->where('id_accion',$id);
		$query = $this->db->get('accion');
		if ($query->num_rows() == 1) 
		{
			return $query->row();
		} 
		else
		{
			return FALSE;		
		}			
	}
	
	function insert($data)
	{
		$result=$this->db->insert('accion', $data);
		if($result=="1")		
			echo "<script>alert('Tarea agregada Exitosamente.');</script>";
		 else
			echo "<script>alert('Error al Agregar la tarea.');</script>";

	}
	
	function update ($id,$data)
	{
		$this->db->where('id_accion', $id);
		$this->db->update('accion', $data);	
	}
	
	function delete ($id)
	{
		$this->db->where('id_accion', $id);
		$this->db->delete('');
	}
	
	function setNivel()
	{
		/*
		INSERT INTO `gestion`.`nivel` (`id_parent`, `id_child`) 
		VALUES (NULL, NULL);
		*/
	}

}